var storage = {
	setStorage: function(obj) {
		console.log(obj);
  var storage = window.localStorage;
  if (storage) {
    localStorage.setItem(obj.name, obj.value)
  } else {
    var _obj = obj.name + "=" + obj.value;
    document.cookie = _obj;
  }
},
getStorage:function(key) {
  var result = {};
  var storage = window.localStorage;
  if (storage) {
  	console.log(storage,key);
    return storage.getItem(key);
  } else {
  	console.log(key);
    var cookie = document.cookie.split('; ');
    cookie.forEach(function(item) {
      var pair = item.split('=');
      result[pair[0]] = pair[1];
    });
    return result[key];
  }

},
deleteStorage: function(key) {
  var exp = new Date();
  var storage = window.localStorage;
  exp.setTime(exp.getTime() - 1);
  var value = this.getStorage(key);
  if (value != null) {
    storage ?
      storage.removeItem(key) :
      document.cookie = key + "=" + value + ";expires=" + exp.toGMTString();
  }
},
storageClear: function() {
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cookie = document.cookie.split('; ');
  if (window.localStorage) {
    localStorage.clear();
  } else {
    if (cookie.length == 0) {
      return false;
    }
    cookie.forEach(function(item) {
      var pair = item.split('=');
      document.cookie = pair[0] + "=" + pair[1] + ";expires=" + exp.toGMTString();
    });
  }
}
}